package org.example.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.example.pojo.DUniform;
import org.example.pojo.select.DUniformSelect;
import org.example.service.DUniformService;
import org.example.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/uniform")
@Tag(name = "厂服登记API",description = "Uniform Controller")
public class DUniformController {

    @Autowired
    private DUniformService dUniformService;

    @Operation(summary = "获取厂服信息")
    @PostMapping("/selectAll")
    public Result<Map> selectAll(@RequestBody DUniformSelect dUniformSelect){
        return dUniformService.selectAll(dUniformSelect);
    }

    @Operation(summary = "添加厂服信息")
    @PostMapping("/addUniform")
    public Result<Map> addUniform(@RequestBody DUniformSelect dUniformSelect){
        return dUniformService.addUniform(dUniformSelect);
    }

    @Operation(summary = "修改厂服信息")
    @PostMapping("/updateUniform")
    public Result<Map> updateUniform(@RequestBody DUniform dUniform){
        return dUniformService.updateUniform(dUniform);
    }

    @Operation(summary = "删除厂服信息")
    @PostMapping("/deleteUniform")
    public Result<Map> deleteUniform(@RequestBody DUniformSelect dUniformSelect){
        return dUniformService.deleteUniform(dUniformSelect);
    }

    @Operation(summary = "上传厂服信息")
    @PostMapping("/upload")
    public Result<Map> uploadUniform(@RequestParam("file") MultipartFile file) {
        return dUniformService.uploadUniform(file);
    }


}
